
Use NEXUS_DB

GO
--------------------------------------Insert---------------
CREATE PROC insertAccount
	@AccountID varchar(16),
	@PlanDetailID int ,
	@CustomerID int ,
	@Status int 
AS
INSERT INTO  Account(AccountID,PlanDetailID,CustomerID,Status) VALUES(@AccountID,@PlanDetailID,@CustomerID,@Status)

--insertAccount 'da',1,1,1
GO
---------------------------------------------------update-------------------
CREATE PROC updateAccount
	@AccountID varchar(16),
	@PlanDetailID int ,
	@CustomerID int ,
	@Status int 
AS
UPDATE Account SET	
	PlanDetailID =@PlanDetailID,
	CustomerID =@CustomerID,
	Status =@Status
WHERE AccountID =@AccountID
GO
---------------------------------------------------updateStatusAccount-------------------
CREATE PROC updateStatusAccount
	@AccountID varchar(16),
	@Status int 
AS
UPDATE Account SET	
	Status =@Status
WHERE AccountID =@AccountID
GO
---------------------------------------Delete--------------------

CREATE PROC deleteAccount
	@AccountID varchar(16)
AS
	DELETE FROM Account WHERE AccountID=@AccountID
GO
---------------------------------------------getAlll---------------
CREATE PROC getAllAccount
AS
SELECT     Account.*, Custormer.CustomerFullName
FROM         Account INNER JOIN
                      Custormer ON Account.CustomerID = Custormer.CustomerID
GO
------------------------------------getAccountByID--------------
CREATE PROC getAccountByID
	@AccountID varchar(16)
AS
	Select * FROM Account WHERE AccountID=@AccountID
GO

